package main

import "fmt"
import "sync"

var wg sync.WaitGroup

func test1() {
	defer wg.Done()
	for i := 0; i < 10; i++ {
		fmt.Printf("打印输出：%v\n", i)
	}
}

func test2() {
	defer func() {
		if err := recover(); err != nil {
			fmt.Println("程序异常：", err)
		}
	}()
	defer wg.Done()
	var myMap map[string]string 
	myMap["name"] = "小王子"
}
func main() {
	wg.Add(1)
	go test1()
	wg.Add(1)
	go test2()
	wg.Wait()
	fmt.Println("程序运行结束……")
}